#ifndef NDK_TEST_H
#define NDK_TEST_H

#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>

#include <ndk.h>
#include <ndk_set_var.h>

ngx_int_t ngx_http_ndk_test_handler(ngx_http_request_t *r, ngx_str_t *res, ngx_http_variable_value_t *v);

// static void *ngx_http_ndk_test_create_loc_conf(ngx_conf_t *cf);
// static char *ngx_http_ndk_test_merge_loc_conf(ngx_conf_t *cf, void *parent,
//             void *child);

static ndk_set_var_t  ngx_http_ndk_test_filter = {
    NDK_SET_VAR_VALUE,
    (void *) ngx_http_ndk_test_handler,
    1,
    NULL
};

static ngx_command_t ngx_http_ndk_test_commands[] = {
   {
       ngx_string ("ndk_test"),
        NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF
            |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12,
        ndk_set_var_value,
        0,
        0,
        &ngx_http_ndk_test_filter
    },
    ngx_null_command
};

static ngx_http_module_t  ngx_http_ndk_test_module_ctx = {
    NULL,                                 /* preconfiguration */
    NULL,                                 /* postconfiguration */

    NULL,                                  /* create main configuration */
    NULL,                                  /* init main configuration */

    NULL,                                  /* create server configuration */
    NULL,                                  /* merge server configuration */
    NULL,
    NULL
    //ngx_http_ndk_test_create_loc_conf,     /* create location configuration */
    //ngx_http_ndk_test_merge_loc_conf       /*  merge location configuration */
};

ngx_module_t  ngx_http_ndk_test_module = {
    NGX_MODULE_V1,
    &ngx_http_ndk_test_module_ctx,          /* module context */
    ngx_http_ndk_test_commands,             /* module directives */
    NGX_HTTP_MODULE,                        /* module type */
    NULL,                                   /* init master */
    NULL,                                   /* init module */
    NULL,                                   /* init process */
    NULL,                                   /* init thread */
    NULL,                                   /* exit thread */
    NULL,                                   /* exit process */
    NULL,                                   /* exit master */
    NGX_MODULE_V1_PADDING
};


#endif
